using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;

namespace Jbe.TestSuite.Infrastructure.Interface.Services
{
    /// <summary>
    /// Describes a document.
    /// </summary>
    public interface IDocument
    {
        event EventHandler DocumentActivated;
        event EventHandler DocumentDeactivated;
        event EventHandler Disposed;

        IDocumentType DocumentType { get; }
        string FileName { get; }

        void Save(string fileName);
    }

    /// <summary>
    /// Describes a document type.
    /// </summary>
    public interface IDocumentType
    {
        string Description { get; }
        string Extension { get; }
    }

    /// <summary>
    /// Describes a document factory which is able to create new documents and
    /// open existing ones.
    /// </summary>
    public interface IDocumentFactory : IDocumentType
    {
        IDocument New();
        IDocument Open(string fileName);
    }

    /// <summary>
    /// The IDocumentManager keeps track of the registered document types and it is
    /// able to create new documents.
    /// </summary>
    public interface IDocumentManager
    {
        ReadOnlyCollection<IDocumentType> DocumentTypes { get; }
        
        void Register(IDocumentFactory documentFactory);
        void New(IDocumentType documentType);
    }
}
